Apple, the Apple logo, and Macintosh are registered trademarks of Apple Computer, Inc.
Mac and OpenDoc are trademarks of Apple Computer, Inc.
Introduction
OpenDoc supports the Text Services Manager (TSM), and, in particular inline text input. OpenDoc does nothing special to support the TSMTE extension. So you have to do some additional work as for a current QuickDraw application which is using TextEdit with the TSMTE extension. The extension is named "Inline Support" in the English system with the Japanese Language Kit or "ÉCÉìÉâÉCÉìí«â¡ã@î\" in the Japanese system. It provides you the inline input in TextEdit easily.
What's TSMTE?
TSMTE is an extension to the Text Services Manager that does the second part of the work for you if you use TextEdit. It provides Apple event handlers that handle all interactions between an input method and TextEdit. The handlers are kept in the system heap, so they are shared between all applications. TSMTE can reduce the effort needed to implement inline input to a day or two. (See Technical Notes TE27 for the details)
General support
OpenDoc calls InitTSMAwareApp, CloseTSMAwareApp, TSMEvent, TSMMenuSelect, and SetTSMCursor at the appropriate times. Parts do not need to call any of these.
Inline input support
First, you need to specify the definition to include the TSMTE header file in your source code as follows. The header file is contained in the Developer CD.
#ifdef __TSMTE__
#include "TSMTE.h"
#endif
Parts wishing to use the TSMTE extension must check for its existence themselves.
long result;
if (Gestalt(kTSMTESignature, &result) == noErr &&
(result & (1 << gestaltTSMTE)) != 0)
// You can use TSMTE. Set the TSMTE available flag to kODTrue.
else
// You cannot use TSMTE. Set the TSMTE available flag to kODFalse.
After creating a text edit record by calling TENew or TEStyleNew, the part has to create a TSM document and enable the inline input by calling UseInputWindow API.
(*tsmteH)->textH = theTE; // A handle to the TERec to be inline input.
(*tsmteH)->preUpdateProc = kODNULL;
(*tsmteH)->postUpdateProc = kODNULL;
(*tsmteH)->updateFlag = kTSMTEAutoScroll;
(*tsmteH)->refCon = kODNULL;
UseInputWindow(kODNULL, kODFalse);
}
}
When you activate or deactivate the text edit record, you have to call the API for activating/deactivating the TSM document at the same time.
// Activate the specified text edit record
if (the TSMTE available flag is kODTrue)
{
ActivateTSMDocument(tsmDocID);
}
TEActivate(theTE);
// Deactivate the specified text edit record
if (the TSMTE available flag is kODTrue)
{
DeactivateTSMDocument(tsmDocID);
}
TEDeactivate(theTE);
Finally, when the text edit record is removed and released by calling TEDispose, you have to call the API for TSM at the same time.
// Dispose the specified text edit record
if (the TSMTE available flag is kODTrue)
{
DeleteTSMDocument(tsmDocID);
}
TEDispose(theTE);
TSM document Share
To be added in DR4.
Additional Info
See also TSM support recipe in the folder Documentation:Recipes.
Regarding information on TSMTE, you can find technical notes, the TSMTE extension, header files, and sample code is available on the Developer CD. The latest information is on the May 95 CD.